package mest.util.hankUtil;


import mest.service.cxj.DictionariesOrderService;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import java.util.UUID;

/**
 * @Classname Util_CodeFactory
 * @Description TODO
 * @Date 2019/12/3 14:16
 * @Created by 18416
 * @Auther: henk
 */
public class Util_CodeFactory {
    @Resource
    private DictionariesOrderService dos;
    //仓库流-生成单号
    public static String create_warehouse_saleout_CODE(String record){
        SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHH");
        String newDate=sdf.format(new Date());
        StringBuilder idsbs = new StringBuilder();
        int radomInt =(int)((Math.random()*9+1)*100000);
        String code = idsbs.append(Util_Code.warehouse_saleout_CODE + newDate + "-"  + radomInt+"-"+record).toString();
        return code;
    }

    //仓库流-生成单号
    public static String create_warehouse_takematerial_CODE(String record){
        SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHH");
        String newDate=sdf.format(new Date());
        StringBuilder idsbs = new StringBuilder();
        int radomInt =(int)((Math.random()*9+1)*100000);
        String code = idsbs.append(Util_Code.warehouse_takematerial_CODE + newDate + "-"  + radomInt+"-"+record).toString();
        return code;
    }


    //数据流-生成单号plan_takematerial
    public static String create_plan_takematerial_CODE(String record){
        SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHH");
        String newDate=sdf.format(new Date());
        StringBuilder idsbs = new StringBuilder();
        int radomInt =(int)((Math.random()*9+1)*100000);

        String code = idsbs.append(Util_Code.plan_takematerial_CODE + newDate +  "-" + radomInt+"-"+record).toString();
        return code;
    }


    //数据流-生成单号plan_saleout
    public static String create_plan_saleout_CODE(String record){
        SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHH");
        String newDate=sdf.format(new Date());
        StringBuilder idsbs = new StringBuilder();
        int radomInt =(int)((Math.random()*9+1)*100000);

        String code = idsbs.append(Util_Code.plan_saleout_CODE + newDate +  "-" + radomInt+"-"+record).toString();
        return code;
    }

}
